﻿@model PagedList<Core_TicketHistory>
@{
    ViewBag.ParentUrl = "/Ticket/Receive";
    ViewBag.Title = "领用记录";
}
@section breadcrumb
{
    <ul class="breadcrumb">
        <li>
            <i class="ace-icon fa fa-home home-icon"></i>
            <a href="/">控制台</a>
        </li>
        <li class="active">@ViewBag.Title</li>
    </ul><!-- .breadcrumb -->
}
<div class="row">
    <div class="col-xs-12">
        <div class="table-responsive">

            <h4 class="pink">
                <i class="ace-icon fa fa-hand-o-right icon-animated-hand-pointer blue"></i>
                <a href="###" role="button" class="green" data-toggle="modal">@ViewBag.Title</a>
            </h4>
            <div class="hr hr-18 dotted hr-double"></div>
            <!-- PAGE CONTENT BEGINS -->
            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th>产品名称</th>
                        <th>单证名称</th>
                        <th>总次数</th>
                        <th>剩余次数</th>
                        <th>单证起始号</th>
                        <th>单证终止号</th>
                        <th>发放时间</th>
                        <th>领用时间</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model)
                    {

                        <tr>
                            <td>@item.H_ProductName</td>
                            <td>@item.H_TicketName</td>
                            <td>@item.H_Count</td>
                            <td>@item.H_RemainCount</td>
                            <td>@item.H_SNo</td>
                            <td>@item.H_ENo</td>
                            <td>@item.H_CreateTime</td>
                            <td>@item.H_ReciveTime</td>
                            <td>@UtilPartialView.YesOrNo("是", "否", item.H_State == 2)</td>
                            <td>

                                @if (item.H_State == 2)
                                {
                                    <div class="btn-group">
                                        <a class="btn btn-xs btn-success tooltip-info" data-rel="tooltip" data-placement="top" title="领用" href="###" data-val="@item.H_Id" name="btnOption">
                                            领用
                                            <i class="ace-icon fa fa-check bigger-120"></i>
                                        </a>
                                    </div>
                                }
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
        </div> <!-- PAGE CONTENT ENDS -->
        @Html.Pager(Model, new PagerOptions { FirstPageText = "首页", PrevPageText = "上一页", NextPageText = "下一页", LastPageText = "末页", PageIndexParameterName = "id", NumericPagerItemCount = 5, ContainerTagName = "ul", CssClass = "pagination", CurrentPagerItemTemplate = "<li class=\"active\"><a href=\"#\">{0}</a></li>", DisabledPagerItemTemplate = "<li class=\"disabled\"><a>{0}</a></li>", PagerItemTemplate = "<li>{0}</li>", Id = "mvcpager" })
    </div><!-- /.col -->
</div><!-- /.row -->

@section footer{
    <script src="/assets/js/bootbox.min.js"></script>
    <script>
        $(function () {
            $('a[name="btnOption"]').on('click', function () {
                $.post('/Ticket/receive', { id: $(this).data('val') }, function (o) {
                    //alert(o.Msg);
                    if ('ok' == o) {
                        bootbox.alert("操作成功！", function () {
                            //window.location.reload();
                            location.reload();
                        });
                    } else {
                        bootbox.alert("操作有误！");
                    }
                });
            });
        });
    </script>
}